﻿function HBPaoPao(name) { //初始化属性
    this.name = name;      //对象名称
}

HBPaoPao.prototype.isie=function () {
    if (navigator.userAgent.toLowerCase().indexOf('msie') != -1) {
        return true;
    }
    else {
        return false;
    }
}  
//返回
HBPaoPao.prototype.getposition = function(obj) {
    var r = new Array();
    r['x'] = obj.offsetLeft;
    r['y'] = obj.offsetTop;
    while (obj = obj.offsetParent) {
        r['x'] += obj.offsetLeft;
        r['y'] += obj.offsetTop;
    }
    return r;
}
//显示提示层
HBPaoPao.prototype.showhintinfo = function(obj, divid, objleftoffset, objtopoffset, objheight, showtype, objtopfirefoxoffset) {

    var p = this.getposition(obj);

    if ((showtype == null) || (showtype == "")) {
        showtype == "up";
    }

    var indexdiv_ = document.getElementById(divid);
    indexdiv_.style.display = 'block';
    indexdiv_.style.position = "absolute";
    indexdiv_.style.zIndex = 500;
    
    

    if (objtopfirefoxoffset != null && objtopfirefoxoffset != 0 && !this.isie()) {
        indexdiv_.style.top = p['y'] + parseInt(objtopfirefoxoffset) + "px";
    }
    else {
        if (objtopoffset == 0) {
            if (showtype == "up") {
                indexdiv_.style.top = p['y'] - indexdiv_.offsetHeight - 5 + "px";
            }
            else {
                indexdiv_.style.top = p['y'] + obj.offsetHeight + 5 + "px";
            }
        }
        else {
            indexdiv_.style.top = p['y'] + objtopoffset + "px";
        }
    }
    indexdiv_.style.left = p['x'] + objleftoffset + "px";
}

//隐藏提示层
HBPaoPao.prototype.hidehintinfo = function(divid) {
    document.getElementById(divid).style.display = 'none';
}

var HBPaoPao = new HBPaoPao("HBPaoPao");